FROM openjdk:8-jre-slim

MAINTAINER xiongjunfeng@haocang.com

ENV TZ=Asia/Shanghai \
    HBASE_VER=1.2.12 \
    HBASE_HOME=/home/hbase

ENV HBASE_CONF_DIR=${HBASE_HOME}/conf \
    PATH=${PATH}:${HBASE_HOME}/bin

COPY sources.list.debian /etc/apt/sources.list

# Prerequisites (SNAPPY)
# install libsnappy-dev
# copy hadoop_home/lib/native /usr/lib/native
# export HBASE_LIBRARY_PATH= /usr/lib/native
RUN apt-get update \
  && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl procps net-tools netcat gosu \
  && rm -rf /var/lib/apt/lists/*

# Install hbase
RUN useradd -md $HBASE_HOME hadoop \
  # https://archive.apache.org/dist/hbase/hbase-1.2.12/hbase-1.2.12-bin.tar.gz
  && curl -O --progress http://soft.hc-yun.com/base/software/hbase-${HBASE_VER}-bin.tar.gz \
  && tar -xzf hbase-${HBASE_VER}-bin.tar.gz -C $HBASE_HOME --strip-components 1 \
  && mkdir -p ${HBASE_HOME}/logs \
  && rm -f hbase-${HBASE_VER}-bin.tar.gz

WORKDIR $HBASE_HOME

VOLUME $HBASE_HOME/logs

# Default Conf Files
COPY conf/ /opt/hbase-config

EXPOSE 16010 16030
